package com.stn.zjx.givingtreasure.net.impl;

import android.annotation.SuppressLint;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheEntity;
import com.lzy.okgo.cache.CacheMode;
import com.lzy.okgo.callback.StringCallback;
import com.stn.zjx.givingtreasure.net.UserDynamicApi;
import com.stn.zjx.givingtreasure.net.UserDynamicLikeApi;
import com.stn.zjx.givingtreasure.utils.ToolsUtils;

import org.json.JSONObject;

public class UserDynamicLikeNetImpl {



    /**
     * @apiNote 设置动态为喜欢
     * @param token token
     * @param tag 标签
     * @param callback 请求回调
     */
    @SuppressLint("CheckResult")
    public static void set_like_dynamic(String token,
                                    Integer userDynamicId,
                                  String tag, StringCallback callback){
        String data="";
        JSONObject jsonObject=new JSONObject();
        try {
            jsonObject.put("userDynamicId",userDynamicId);
            data= ToolsUtils.getEncryptionParams(jsonObject.toString());
        } catch (Exception e) {
            e.printStackTrace();

        }
        OkGo.<String>post(UserDynamicLikeApi.set_like_dynamic)
                .tag(tag)
                .isSpliceUrl(true)
                .upJson("")
                .params("token",token)
                .params("data",data)
                .execute(callback);

    }



    /**
     * @apiNote 设置动态为不喜欢
     * @param token token
     * @param tag 标签
     * @param callback 请求回调
     */
    @SuppressLint("CheckResult")
    public static void set_no_like_dynamic(String token,
                                        Integer userDynamicId,
                                        String tag, StringCallback callback){
        String data="";
        JSONObject jsonObject=new JSONObject();
        try {
            jsonObject.put("userDynamicId",userDynamicId);
            data= ToolsUtils.getEncryptionParams(jsonObject.toString());
        } catch (Exception e) {
            e.printStackTrace();

        }
        OkGo.<String>post(UserDynamicLikeApi.set_no_like_dynamic)
                .tag(tag)
                .isSpliceUrl(true)
                .upJson("")
                .params("token",token)
                .params("data",data)
                .execute(callback);

    }
}
